/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.iti.jets.gpts.bean;

import com.iti.jets.gpts.pojo.Comments;
import com.iti.jets.gpts.pojo.User;
import com.iti.jets.gpts.service.UserCommentService;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import org.primefaces.event.SelectEvent;
import org.primefaces.event.UnselectEvent;
import org.primefaces.model.SelectableDataModel;

/**
 *
 * @author khalifaabdelaziz
 */
@ManagedBean
@ViewScoped
public class UserCommentsBean implements Serializable{
    private UserCommentService commentService;
    private List<Comments> commentses;
    private Comments select;
    private User user;
 
    /**
     * Creates a new instance of UserCommentsBean
     */
    public UserCommentsBean() {
       
    }

    public List<Comments> getCommentses() {
        return commentses;
    }

    public void setCommentses(List<Comments> commentses) {
        this.commentses = commentses;
    }

    public Comments getSelect() {
        return select;
    }

    public void setSelect(Comments select) {
        this.select = select;
    }
    
    public void onRowSelect(SelectEvent event) {
        Comments object = (Comments) event.getObject();
        System.out.println("event sdsdsdsdsdsd"+object.getId());
    }
 
    public void onRowUnselect(UnselectEvent event) {
        
        Comments object = (Comments) event.getObject();
        System.out.println("UnselectEvent sdsdsdsdsdsd"+object.getId());
    }
     public void useronRowSelect(SelectEvent event) {
        User object = (User) event.getObject();
        System.out.println("event sdsdsdsdsdsd"+object.getId());
        commentService = new UserCommentService(); 
        commentses = commentService.getCommnetUser(object.getId()); 
    }
 
    public void useronRowUnselect(UnselectEvent event) {
        
        User object = (User) event.getObject();
        System.out.println("UnselectEvent sdsdsdsdsdsd"+object.getId());
         
        
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
    
}
